﻿package cn.valorin.configuration;

import java.io.File;
import java.io.IOException;

import static cn.valorin.configuration.languagefile.MessageSender.gm;

import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;

public class Configuration{
	public static File dataFile = new File("plugins/Duanwu/data.yml");
	public static FileConfiguration data;
	
	public static void loadData() {
		data = YamlConfiguration.loadConfiguration(dataFile);
		data.options().copyDefaults(true);
	}
	
	public static void saveData() {
	    try {
		    data.save(dataFile);
	    } catch (IOException e) {
	        Bukkit.getConsoleSender().sendMessage(
	    	gm("&c载入data.yml时发生了一些错误！",null));
	    }
	}
}
